#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using i128 = __int128;
const int N = 1e6 + 5;

void solve() {
    int x;
    cin >> x;
    int y = x;
    string s;
    while (y) {
        s += y % 2 + '0';
        y >>= 1;
    }
    int i = 0, j = s.size() - 1;
    while (i < s.size() && s[i] == '0') i++;
    while (j >= 0 && s[j] == '0') j--;
    string t = s.substr(i, j - i + 1);
    string p = t;
    reverse(p.begin(), p.end());
    if (__builtin_popcount(x) % 2 == 0 && t == p) {
        cout << "YES\n";
    } else
        cout << "NO\n";

    return;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t;
    cin >> t;
    while (t--) solve();

    return 0;
}